"use strict";
cc._RF.push(module, '15a86PmUF1OAqriCHunpeM+', 'level_peopleArchery_boxDialogItem');
// scripts/levelBundles/level_PeopleArchery/pageItem/level_peopleArchery_boxDialogItem.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var gameEngine_1 = require("../../../engines/gameEngine");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var level_peopleArchery_boxDialogItem = /** @class */ (function (_super) {
    __extends(level_peopleArchery_boxDialogItem, _super);
    function level_peopleArchery_boxDialogItem() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.iconNode = null;
        _this.videoNode = null;
        _this.lbText = null;
        _this.data = null;
        _this.page = null;
        return _this;
    }
    level_peopleArchery_boxDialogItem.prototype.bindData = function (data, page) {
        this.data = data;
        this.page = page;
        this.refrenshItem();
    };
    level_peopleArchery_boxDialogItem.prototype.refrenshItem = function () {
        this.videoNode.active = this.data.videoFlag == "1";
        var str = gameEngine_1.default.getManagers().peopleArcheryManager.getOptionText(this.data);
        this.lbText.string = str;
        this.loadIcon();
    };
    level_peopleArchery_boxDialogItem.prototype.loadIcon = function () {
        //TODO 加载icon
    };
    level_peopleArchery_boxDialogItem.prototype.onBtnMe = function () {
        if (this.data.videoFlag == "1") {
            if (gameEngine_1.default.getServices().userSrv.getCoins() < 1) {
                gameEngine_1.default.getModules().uiControlModule.showMessageBox("免广告币不足");
                return;
            }
            gameEngine_1.default.getServices().userSrv.setCoins(-1, true);
        }
        // this.page.selectItem(this);
    };
    __decorate([
        property({ type: cc.Node, tooltip: "显示节点" })
    ], level_peopleArchery_boxDialogItem.prototype, "iconNode", void 0);
    __decorate([
        property({ type: cc.Node, tooltip: "视频节点" })
    ], level_peopleArchery_boxDialogItem.prototype, "videoNode", void 0);
    __decorate([
        property({ type: cc.Label, tooltip: "参数文本" })
    ], level_peopleArchery_boxDialogItem.prototype, "lbText", void 0);
    level_peopleArchery_boxDialogItem = __decorate([
        ccclass
    ], level_peopleArchery_boxDialogItem);
    return level_peopleArchery_boxDialogItem;
}(cc.Component));
exports.default = level_peopleArchery_boxDialogItem;

cc._RF.pop();